package vip.xiaonuo.device.modular.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.device.modular.service.DeviceApiService;
import vip.xiaonuo.device.vo.Result;

import javax.annotation.Resource;

/**
 * 已作废，每个离线事件独立上报
 */
@Slf4j
@Api(tags = "事件日志控制器")
@ApiSupport(author = "SNOWY_TEAM", order = 1)
@RestController
@Validated
@Deprecated
public class DeviceClientOfflineController {
    @Resource
    private DeviceApiService deviceOfflineService;

    @ApiOperationSupport(order = 1)
    @ApiOperation("离线上报")
    @PostMapping("/api/client/offlinedata")
    public Result offlineData(@RequestBody String jsonStr) {
        log.info(jsonStr);
        return deviceOfflineService.execute(jsonStr);
    }
}
